package com.bins.dentist.clinic.controller;

import com.bins.dentist.clinic.model.dto.LoginDto;
import com.bins.dentist.clinic.model.vo.LoginVo;
import com.bins.dentist.clinic.model.vo.ResultVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.UUID;

@Controller
public class LoginController {

    @RequestMapping("/index")
    public String index() {
        return "index";
    }

    @RequestMapping("/home")
    public String home() {
        ModelAndView mv = new ModelAndView();
        mv.setViewName("home");
        return "home";
    }

    @PostMapping("/login")
    @ResponseBody
    public ResultVo<LoginVo> login(@RequestBody LoginDto dto) {
        LoginVo resultVo = new LoginVo();
        resultVo.setToken(UUID.randomUUID().toString());
        return ResultVo.ok().data(resultVo);
    }
}
